package com.my.swas.common.base;

/**
 * @Description:
 * @author: :MaYong
 */
public enum ResultEnum {
    UNAUTHORIZED("401","权限失效"),

    SUCCESS("00000", "操作成功"),
    WAIT("10001", "操作中"),
    ERROR("99999", "操作失败");


    private String code;

    private String msg;

    ResultEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 根据枚举名称--获取枚举编码
     */
    public static String getCode(String name) {
        for (ResultEnum resultEnum : ResultEnum.values()) {
            if (resultEnum.name().equals(name)) {
                return resultEnum.code;
            }
        }
        return null;
    }

}
